
<script src="web/assets/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="web/assets/plugins/bootstrap-select2/select2.min.js" type="text/javascript"></script>
<script src="web/assets/plugins/jquery-datatable/js/jquery.dataTables.min.js" type="text/javascript" ></script>
<script src="web/assets/js/table_configuracion.js" type="text/javascript"></script>
<script src="./fuentes/view/sorteo/js/script_ajax_sorteo.js" type="text/javascript"></script>

<!-- Modal -->
<div class="modal fade" id="myModalSorteoADD" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <br>
                <i class="icon-credit-card icon-7x"></i>
                <h4 id="myModalLabel" class="semi-bold">Sorteo</h4>
                <p class="no-margin"> </p>
                <br>
            </div>

            <div class="modal-body">
                <form  action="./fuentes/controller/Sorteo.php" id="formSorteo" name="formSorteo" autocomplete="off" > 
                    <?php require_once '/FormSorteo.php'; ?>
                </form>    
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
</div>

<div class="clearfix"></div>
<div class="content">  
    <div class="row" id="cuponView">
        <div class="col-md-12">
            <div class="grid simple ">
                <div class="grid-title no-border">
                    <h4><span class="semi-bold">Listado de Sorteos</span></h4>

                    <button style="float: right;" class="btn btn-success btn-xs " id="agregar" data-toggle="modal"  data-target="#myModalSorteoADD"> Agregar</button>
                    <div class="labelRight" id="error">	

                    </div>
                </div>
                <div class="grid-body no-border">
                    <table class="table table-hover no-more-tables table-condensed  " id="sorteoTABLE">
                        <thead>
                            <tr>
                                <th style="width:1%" >ID</th>
                                <th style="width:25%">Nombre </th>
                                <th class='text-center' style="width:8%">Fecha Sorteo</th>
                                <th  class='text-center' style="width:5%">Encuesta</th>
                                <th  class='text-center'style="width:5%">Habilitado</th>
                                <th  class='text-center' style="width:10%">Accion</th>
                            </tr>
                        </thead>
                        <tbody id="sorteoList">
                            <?php
                            if ($sorteos) {
                                foreach ($sorteos as $dato) {
                                    echo "<tr >"
                                            . "<td>".$dato["id"]."</td>"
                                            . "<td>".$dato["nombre"]."</td>"
                                            . "<td class='text-center'>".date("d/m/Y", strtotime($dato["fecha_sorteo"]))."</td>"
                                            . "<td class='text-center'>". getLabel($dato["habilita_encuesta"])."</td>"
                                            . "<td class='text-center'>". getLabel($dato["habilitado"])."</td>"
                                            . "<td class='text-center'>"
                                            . "<button class='btn btn-success btn-xs btn-mini' onclick='editDatos(" . $dato["id"] . ")'  title='Editar' ><i class='fa fa-pencil'></i></button>&nbsp;&nbsp;"
                                            . "<button class='btn btn-success btn-xs btn-mini' onclick='eliminarDato(" . $dato["id"] . ")' title='Eliminar' ><i class='fa fa-times'></i></button>&nbsp;&nbsp;"
                                            . "<button class='btn btn-success btn-xs btn-mini' onclick='cupon(" . $dato["id"] . ")'  title='Cupones' ><i class='fa fa-random'></i></button>"
                                            ."</td>"
                                        . "</tr>";
                                }
                            } 
                            function getLabel($yes) {
                                if($yes) return "<span class='label label-success'>SI</span>";
                                else return "<span class='label label-warning'>NO</span>";
                            }
                            ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>



    <!-- END PAGE --> 


</div>


